const mysql = require('mysql')

const pool = mysql.createPool({
    user: "root",
    password: "root",
    database: "day_crud",
    host: "localhost",
    port: 3306
})

function exec(sql) {
    return new Promise((resolve, reject) => {
        pool.query(sql, (err, data) => {
            if (err) {
                reject(err)
            }
            resolve(data)
        })
    })
}

module.exports = {
    exec
}